import router from './index'
import { usePort } from '@/hooks/index'
import { useRouterTravelStore } from '@/store'
import { message } from 'ant-design-vue'
import { RouteRecordRaw } from 'vue-router'
import ApppConfig from 'AppConfig'

// const useRouterTravel = useRouterTravelStore()

router.beforeEach((to, from, next) => {
  document.title = ApppConfig.appName
  usePort(to.meta.title as string)
  if (from.path !== '/login') {
    console.log('to:', to)

    useRouterTravelStore().push(to as any)
  }
  next()
})

router.afterEach((to, from, failure) => {
  // useRouterTravelStore().end()
})
